<%@page import="java.util.Collection"%>
<%@page import="co.gov.medellin.ssti.sub.service.ConsultasService"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@page
	import="java.util.Vector,co.gov.medellin.ssti.sub.paoyer.administration.model.vo.UserVO,java.text.SimpleDateFormat,java.util.Calendar"%>
<link href="<%=request.getContextPath() + "/css/bloques.css"%>"
	rel="stylesheet" type="text/css">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ActivarCorrecta</title>
</head>
<body>
	<form>
		<P></P>
		<P></P>

		<%
			Vector<String> codsub = new Vector<String>();
			int modificar;
			Collection<String> rs = null;
			String strcod = "";
			String strcod1 = "";
			
			ConsultasService consulta = new ConsultasService();
			String strcont = request.getParameter("cont");
			int cont = Integer.parseInt(strcont.trim());
			int i = 0;
			for (i = 0; i < cont; i++) {
				String activar = request.getParameter("Activar" + i);
				if (activar != null) {
					//Proceso para la auditoria
					UserVO user = (UserVO) request.getSession().getAttribute(
							"userInfo");
					String terminalAddress = request.getRemoteAddr();
					String strTerminal = ("WEB=" + terminalAddress);
					Calendar c = Calendar.getInstance();
					SimpleDateFormat dateFormat = new SimpleDateFormat(
							"dd/MM/yyyy");
					//Fin del proceso
					String strArr[] = { user.getName(),
							dateFormat.format(c.getTime()), strTerminal,
							activar };

					modificar = consulta.getActivarPro2(strArr);
					codsub.addElement(activar);
				}
			}
			if (codsub.size() == 1) {
		%>

		<P align="center">&nbsp;</P>
		<div align="center">
			<table
				style="width: 100%; border: 0; padding: 3px; border-spacing: 3px;">
				<tr>
					<td width="28%">&nbsp;</td>
					<td class="titulosenblanco" width="53%"><FONT size="4">El
							Programa </FONT></td>
					<td width="19%">&nbsp;</td>
				</tr>
				<%
					for (i = 0; i < codsub.size(); i++) {
							strcod = (String) codsub.get(i);
							rs = consulta.getNomPrg(strcod);
							for (String vo : rs) {
				%>
				<tr>
					<td width="28%">&nbsp;</td>
					<td class="celdatabla" width="53%" align="center"><%=vo%></td>
					<td width="19%">&nbsp;</td>
				</tr>
				<%
					}
						}
				%>
				<tr>
					<td width="28%">&nbsp;</td>
					<td class="titulosenblanco" width="53%"><FONT size="3"><FONT
							size="4">fue activado... </FONT></FONT></td>
					<td width="19%">&nbsp;</td>
				</tr>
				<tr>
					<td width="28%">&nbsp;</td>
					<td width="28%">&nbsp;</td>
					<td><a
						href="<%=request.getContextPath()
						+ "/subprogramas/ActivarSubprogramas.do?ori=activar&programa="
						+ strcod%>">
							<img
							src="<%=request.getContextPath() + "/images/activar.gif"%>"
							alt="Activar" width="22" height="22" border="0" /> <br /> <span>Activar
								Subprogramas</span>
					</a></td>
				</tr>
			</table>
		</div>
		<%
			} else {
		%>
		<P align="center">&nbsp;</P>
		<div align="center">
			<table
				style="width: 100%; border: 0; padding: 3px; border-spacing: 3px;">
				<tr>
					<td width="28%">&nbsp;</td>
					<td class="titulosenblanco" width="53%"><FONT size="4">Los
							Programas </FONT></td>
					<td width="19%">&nbsp;</td>
				</tr>
				<%
					for (i = 0; i < codsub.size(); i++) {
							strcod = (String) codsub.get(i);
							rs = consulta.getNomPrg(strcod);
							for (String vo : rs) {
				%>
				<tr>
					<td width="28%">&nbsp;</td>
					<td class="celdatabla" width="53%" align="center"><%=vo%></td>
					<td width="19%">&nbsp;</td>
				</tr>
				<%
					}
						}
				%>
				<tr>
					<td width="28%">&nbsp;</td>
					<td class="titulosenblanco" width="53%"><FONT size="4">fueron
							activados... </FONT></td>
					<td width="19%">&nbsp;</td>
				</tr>
				<tr>
					<td width="28%">&nbsp;</td>
					<td width="28%">&nbsp;</td>
					<td width="28%"><a
						href="<%=request.getContextPath()
						+ "/programas/ConsultarPrograma.do"%>"><img
							src="<%=request.getContextPath() + "/images/BACK1-1.gif"%>"
							border="0" /></a></td>
				</tr>
			</table>
		</div>
		<%
			}
		%>
	</form>
</body>
</html>
